package com.bootdo.clouddo.service.juejin.impl;

import com.bootdo.clouddo.utils.http.JuejinUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import com.bootdo.clouddo.dao.juejin.PostDetailDao;
import com.bootdo.clouddo.domain.juejin.PostDetailDO;
import com.bootdo.clouddo.service.juejin.IPostDetailService;

@Service
public class PostDetailServiceImpl implements IPostDetailService {
	
	@Autowired
	private PostDetailDao dao;

	@Override
	public int save(PostDetailDO post) {
		return dao.insertSelective(post);
	}

	@Override
	public PostDetailDO get(String id) {
		PostDetailDO data = dao.selectByPrimaryKey(id);
		if(data != null) {
            data.setContent(JuejinUtils.getNewImageHost(data.getContent()));
            data.setTranscodeContent(JuejinUtils.getNewImageHost(data.getTranscodeContent()));
		}
		return data;
	}
	

}
